/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package cardpackage;

/**
 *
 * @author apple
 */
public abstract class Card {
     String type;
     double amount;

    public Card() {
    }

    public Card(String type, double amount) {
        this.type = type;
        this.amount = amount;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public double getAmount() {
        return amount;
    }

    public void setAmount(double amount) {
        this.amount = amount;
    }
    
    public abstract double shouldPay(double totalPrice);
    
    public boolean consume(double totalPrice)
    {
        if(this.amount>=this.shouldPay(totalPrice))
        {
            this.amount=this.amount-this.shouldPay(totalPrice);
            return true;
        }
        else
        {
            return false;
        }
    }
}
